local skel = fk.CreateSkill {
  name = "efengqi__lianhuan",
}

Fk:loadTranslationTable{
  ["efengqi__lianhuan"] = "连环",
  [":efengqi__lianhuan"] = "出牌阶段，你可以重铸一张♣牌并横置或重置一名角色；你脱离连环状态时，摸一张牌。",
  ["#efengqi__lianhuan"] = "连环：重铸一张♣牌并横置或重置一名角色",

  ["$efengqi__lianhuan1"] = "伤一敌可连其百！",
  ["$efengqi__lianhuan2"] = "通通连起来吧！",
}

skel:addEffect("active", {
  anim_type = "control",
  card_num = 1,
  target_num = 1,
  prompt = "#efengqi__lianhuan",
  card_filter = function (self, player, to_select, selected)
    return #selected == 0 and Fk:getCardById(to_select).suit == Card.Club
  end,
  target_filter = function (self, player, to_select, selected)
    return #selected == 0
  end,
  can_use = Util.TrueFunc,
  on_use = function(self, room, effect)
    local player = effect.from
    local to = effect.tos[1]
    local chained = not to.chained
    room:recastCard(effect.cards, player, skel.name)
    if not to.dead then
      to:setChainState(chained)
    end
  end,
})

skel:addEffect(fk.ChainStateChanged, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and target == player and not player.chained
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    player:drawCards(1, skel.name)
  end,
})

return skel
